<script type="text/javascript" src="js/ui/CreateTempImg.js"></script>
<script type="text/javascript" src="js/md5.js"></script>
<script type="text/javascript">
    document.domain='www.12301.cc';
    var t=60;
    var ds;
    var type;
    function chMob(a){
        if(a){
            if(!$('#_mob').html()){
                alert('请先绑定手机号');
                return false;
            }
            type='ali';
            $('#chmob h3 label').html('修改支付宝账号');
            $('#chmob span').eq(0).show().end().eq(2).html('新支付宝账号：');
            $('#_mob').show();
            $('#chmob button').eq(1).attr('id','btn').show().end().eq(2).attr('id','').hide();
            $('#chmob div').hide();
            $('#chmob a').show();
        }
        else{
            type='mob';
            $('#chmob h3 label').html('修改绑定手机');
            $('#chmob span').eq(0).hide().end().eq(2).html('新手机号码：');
            $('#_mob').hide();
            $('#chmob button').eq(1).attr('id','').hide().end().eq(2).attr('id','btn').show();
            $('#chmob div').show();
            $('#chmob a').hide();
        }
        $('#mobile').val('');
        $('#yzm').val('');
        $('#mask').toggle();
        $('#chmob').toggle();
        return false;
    }
    function Vcode(){
        if(type=='mob'){
            var res=$.ajax({url:"call/chmob.php", data:{ act:'chH', mobile:$('#mobile').val()}, async:false}).responseText;
            if(res){
                alert(res);
                return false;
            }
        }
        ds=self.setInterval("countdown()",1000);
        $('#btn').attr('disabled',true);
        var mobile=type=='mob'?$('#mobile').val():$('#mob').html();
        $.getJSON("call/jh_mem.php", { action:'SendVcode', stype:'phone', mobile:mobile }, function(json){
            if(json['status']!='ok'){alert(json['msg']);}
            else{alert('验证码已发送!')}
        });

    }
    function countdown(){
        $('#btn').html('获取验证码('+t+')');
        t--;
        if(!t){
            window.clearInterval(ds);
            $('#btn').html('获取验证码').attr('disabled',false);
            t=60;
        }
    }
    function sub_c(){
        $.getJSON("call/jh_mem.php", { action:'VerifyVcode', vcode:$('#yzm').val() }, function(json){
            if(json['status']=='ok'){
                if(type=='mob'){
                    var res=$.ajax({url:"call/chmob.php", data:{ act:'chM', mobile:$('#mobile').val(), ps:hex_md5($('#ps').val())}, async:false}).responseText;
                    if(res!="ok"){$('#ps').next().html(res);}
                    else{
                        alert('手机号修改成功!');
                        window.location.reload();
                    }
                }
                else{
                    var res=$.ajax({url:"call/chmob.php", data:{ act:'chA', alipay:$('#mobile').val()}, async:false}).responseText;
                    if(res!="ok"){$('#yzm').next().html(res);}
                    else{
                        alert('支付宝账号修改成功!');
                        window.location.reload();
                    }
                }
            }
            else{$('#yzm').next().html(json['msg']);}
        });
    }
    function yzali(){
        var mob=$('#mobile').val();
        if(mob){
            window.open('rerified.html?ali='+mob,'_blank');
        }
        else{
            alert('请填写支付宝账号');
        }
    }
    <?if(isset($_REQUEST["b"])){?>
    $(document).ready(function(){
        chMob(1);
    });
    <?}?>
</script>
<link rel="stylesheet" type="text/css" href="css/basic.css"/>
<style type="text/css">
    #img,.change{display:none;}
    .img{border: 1px solid #E1E1E1;height: 100px;padding: 4px;width: 100px;}
    .img img{height:100px; width:100px; }
    #chmob,.dialog{background:#FFF; left:50%; margin-left:-10%; position:absolute; top:217px; width:30%; min-width:350px; _width:400px; vertical-align:super; padding-bottom:20px; border:1px solid #D5DCE2; z-index:100; display:none;}
    #chmob h3, .dialog h3{border-bottom: 2px solid #2A98DA;line-height: 30px;padding-left: 20px;margin-bottom: 10px;}
    #chmob h3 label, .dialog h3 label{font-size: 14px;font-weight: bold;}
    #chmob div,.dialog h3 div{width:100%;}
    .txt{display:inline-block; width:85px; margin-left:34px;line-height:35px;text-align:right;}
    #mobile{height:25px; width:135px; margin-bottom:10px;}
    span.err{color:red;margin-left: 10px;}
    #yzm{height:25px; width:80px;}
    button{cursor: pointer;}
    #ps{height:25px; margin-top:10px;}
    .sub{margin: 10px 0 0 123px; width:100px; height:25px; background:url(images/btn23bg.png); border:1px solid #0E8FF5; color:white; font-weight:bold;border-radius: 2px;}
    .sub:hover{ background:url(images/btn23bg11.png);}
    #btn{ height:20px; line-height:18px; background:#F3F3F3; border:1px solid #AFAFAF; padding:0 8px; margin-left:15px; color:#777777; border-raduis:3px;}
    #btn:hover{ background:#FFF;}
    .close {border: 1px solid #2A98DA;color: #2A98DA;cursor: pointer;display: inline-block;font-size: 18px;font-weight: bold;height: 20px;line-height: 17px;position: absolute;right: 10px;text-align: center;width: 20px;margin-top: 5px;}
</style>
<iframe src="about:blank" style="display: none;" id="hideFrame" name="hideFrame" frameborder="0"></iframe>
<div class="r_content">
    <div id="chmob">
        <h3><label>修改绑定手机</label><button onclick="chMob();" class="close" type="button">X</button></h3>
        <span class="txt">绑定手机号：</span>
        <span id="_mob"><?=$m_info['mobile']?></span>
        <button type="button" id="" onclick="Vcode()">获取验证码</button><br />
        <span class="txt"></span>
        <input type="text" id="mobile" />
        <button type="button" id="btn" onclick="Vcode()">获取验证码</button><br />
        <span class="txt">验证码：</span>
        <input type="text" id="yzm" />
        <span class="err"></span>
        <div>
            <span class="txt">账户密码：</span>
            <input type="password" id="ps" />
            <span class="err"></span>
        </div>
        <button type="button" class="sub" onclick="sub_c()">确认修改</button>
        <a href="javascript:void(0);" onclick="yzali()" title="验证所填写的支付宝账户是否正确">验证支付宝账户</a>
    </div>
    <?include("info_head.html");?>
    <div class="accinf">
        <div class="Picture" onmouseover="$(this).children('a').show();" onmouseout="$(this).children('a').hide();" >
            <div class="img">
                <img src="<?=$m_info['headphoto']?>" id="old_img" />
            </div>
            <a href="javascript:void(0)" onclick="showImg();" class="change" >修改头像</a>
            <!--资料完成度-->
            <div class="setm_bg"></div>
            <div class="setm" style="width:<?=$m?>px;"></div><!--10%时width为10.6px-->
            <div class="setm_top"></div>
            <p>资料完整度<?=round($p*100)?>%</p>
            <!--资料完成度END-->
        </div>
        <div class="info">
            <a href="enterprise_info.html" class="wszl">完善资料</a>
            <h4 class="infh4"><?=$m_info['dname']?><span class="infsp1">(ID：<?=$m_info['account']?>)</span></h4>
            <!-- <p>姓&nbsp;&nbsp;&nbsp;&nbsp;名：<?=$m_info['cname']?></p> -->
            <p>绑定手机：<span id="mob"><?=$m_info['mobile']?></span> <a href="javascript:void(0);" onclick="chMob()"<?=$chmob?> class="infsp2">修改</a></p>
            <p style="display:none;"><span class="infred">您还未绑定支付宝账号</span><a href="#" class="infsp2">点击绑定</a></p><!--支付宝未绑定-->
            <p>支付宝账号：<?=$m_info['alipay']?><a href="javascript:void(0);" onclick="chMob(1)" class="infsp2">修改</a></p><!--支付宝已绑定-->
            <p>最近登录时间：<?=$m_info['lasttime']?></p>
        </div>
    </div>
    <?	if($m_info['dtype']!=5){?>
        <div class="xtg">
            <h4 class="xtgh4">系统公告</h4>
            <ul>
                <?	foreach($noticeList as $v){?>
                    <li><span class="time"><?=$v['btime']?></span><span class="title"><?=$v['title']?></span></li>
                <?	}?>
            </ul>
        </div>
    <?	}?>
</div>
<form class="dialog" name="mainForm" id="mainForm"
      method="post" action="call/uploadAvatar.php"
      enctype="multipart/form-data" >
    <h3><label>修改绑定手机</label><button class="close" type="button">X</button></h3>
    <span class="txt">选择头像：</span>
    <input type="file" name="upfile" id="dimg"/> <!-- -->
    <button id="upload" type="button">确认修改</button>
</form>
<script type="text/javascript" src="js/updLower.js?abc"></script>